<?php
function __autoload($classname){
	include './'.$classname.'.php';
}
$data = $_POST;
$cite = new Cite();
$oldData = $cite->user();
// 取数据文件里面的原数据
//$oldData = file_get_contents("./db/user.txt");
// 把原来的数据转成数组
//$oldData = json_decode($oldData,true);

// 循环所有用户
foreach ($oldData as  $user) {
	if($user['username']==$data['username'] && $user['password']==md5($data['password'])){

		session_start();
		// 写session
		$_SESSION['username'] = $data['username'];

		echo '<script>if(confirm("登录成功")){location.href="./Index.php";}</script>';

		exit();
	}
}


echo '<script>if(confirm("用户或者密码不正确")){location.href="./Index.php";}</script>';



